home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / H-I / HyperHackers.cpt / Hyper-Hackers Queue 1.0 / card_20270.txt < prev    next >
Text File  |  1989-02-26  |  3KB  |  71 lines

  1. -- card: 20270 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3797
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 1
  9. ----- text -----
  10.  
  11. From: winkler@Apple.COM (Dan Winkler)
  12.  
  13. Date: 29 Feb 88 16:45:09 GMT
  14.  
  15. There is no constant in HyperTalk named "newline", only "return"
  16. and "linefeed".  When you write:
  17.  
  18.   read from file f until newline
  19.  
  20. you are not providing a valid expression after the "until".  So, in a
  21. never ending battle to figure out what the heck you meant, the
  22. HyperTalk interpreter guesses that you might forgotten a pair of
  23. quotes, and transforms the line into:
  24.  
  25.   read from file f until "newline"
  26.  
  27. Having thus succeeded in wrenching the line into something syntactically
  28. correct, the interpreter passes control to the read command.  The read
  29. command then does its job, which is to read up to the first character
  30. of the until string, namely "n".  (The reason that read only reads up
  31. to the first character, is that that is all the underlying Macintosh
  32. file system has built in.)
  33.  
  34. I call the above construction an "unquoted literal".  It let's you
  35. do things like
  36.  
  37.   get field fred      instead of      get field "fred"
  38.   go to clip art      instead of      go to "clip art"
  39.  
  40. Unfortunately, I'm still the only person in the world who knows many
  41. secrets of HyperTalk, such as exactly where unquoted literals are
  42. allowed, where they're not, where they are restricted to single tokens,
  43. and where they can be multiple tokens.  Here are a couple rules of
  44. thumb:
  45.  
  46.   1. Unquoted literals are not allowed as sources in an expression.
  47.      (I could have allowed them, but that would be REALLY dangerous.)
  48.   
  49.      put "hello" && "there"  - quotes are required
  50.  
  51.   2. Unquoted literals can only be a single token except for stack names.
  52.      This is because once I decide to take more than one token as unquoted,
  53.      I never know where to stop and so go all the way to the end of the line.
  54.      Stack names are the only thing that occur at the end of the line often
  55.      enough to make this worth it.
  56.  
  57.      go to stack "clip art"  - quotes are optional
  58.      put field "clip art" into it  - quotes are required
  59.  
  60. Unquoted literals exist only for lazy typists and forgetful beginners.
  61. If you can at all manage to supply the quotes, it's much better that
  62. way, mainly because statements that use unquoted literals can suddenly
  63. begin to behave differently if you ever define a variable with the same
  64. name as the unquoted literal.  Fortunately, only the handler can define
  65. things in its scope, but it's still dangerous.
  66.  
  67.  
  68.  
  69. -- part contents for background part 45
  70. ----- text -----
  71. Re: HyperCard bug  <- No, it's a feature.